//
// IOData.cpp for  in /home/lund/Projets/abstract-vm/vmtmp
// 
// Made by florian dewulf
// Login   <dewulf_f@epitech.net>
// 
// Started on  Tue Feb 19 19:04:43 2013 florian dewulf
// Last update Tue Feb 19 21:40:13 2013 florian dewulf
//

#include	"IOData.hpp"

IOData::IOData(const std::string &str) : _state(false)
{
  this->_file.open(str.c_str());
  if (this->_file.is_open() && this->_file.good())
    this->_state = true;
}

IOData::~IOData()
{
}

std::string	IOData::newline()
{
  std::string	str;

  if (this->_state && this->_file.good())
    getline(this->_file, str);
  else if (this->_state) {
    this->_state = !this->_state;
    this->_file.close();
  }
  return (str);
}

void		IOData::display(const std::string &str)
{
  std::cout << str;
}

bool		IOData::getState() const
{
  return (this->_state);
}
